package org.example.Controller;

import org.example.Dao.ApplicationsDao;
import org.example.Pojo.Applications;
import org.example.Service.Impl.ApplicationsImpl;
import org.example.Utils.UnionResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

@RestController
@RequestMapping("/Applications")
public class ApplicationsController {
    @Autowired
    ApplicationsImpl applicationsImpl;
    @RequestMapping("/CreateApplications")
    public UnionResult CreateApplications(Applications applications) {
        return applicationsImpl.CreateApplication(applications);
    }
    @RequestMapping("/QueryMyApplication")
    public UnionResult QueryMyApplication(Applications applications) {
        return applicationsImpl.QueryMyApplication(applications);
    }
    @RequestMapping("/QueryUserApplication")
    public UnionResult QueryUserApplication(Applications applications) {
        return applicationsImpl.QueryUserApplication(applications);
    }
    @RequestMapping("/CancelApplication")
    public UnionResult CancelApplication(Applications applications) {
        return applicationsImpl.CancelApplication(applications);
    }
    @RequestMapping("/GetApplication")
    public UnionResult GetApplication(Applications applications) {
        return applicationsImpl.GetApplication(applications);
    }
    @RequestMapping("/UpdateApplication")
    public UnionResult UpdateApplication(Applications applications) {
        return applicationsImpl.UpdateApplication(applications);
    }
    @RequestMapping("/UploadApplicationFile")
    public UnionResult UploadApplicationFile(@RequestParam("file") MultipartFile file) throws IOException {
        return applicationsImpl.UploadApplicationFile(file);
    }
    @RequestMapping("/GetPassed")
    public UnionResult GetPassed() {
        return applicationsImpl.GetPassed();
    }

}
